﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Drawing;
using System.Linq;
using System.Web;
using WebMobie.Models;
using WebMobie.Models.Entities;
using WebMobie.Modules.Query;

namespace WebMobie.Models
{
	public class WebMobileDbInitializer : CreateDatabaseIfNotExists<WebMobileContext>
	{
		//DropCreateDatabaseAlways
		//DropCreateDatabaseIfModelChanges
		//CreateDatabaseIfNotExists
		protected override void Seed(WebMobileContext context)
		{
			Category cat1 = new Category { Id = Guid.NewGuid(), Name = ".NET Framework" };
			Category cat2 = new Category { Id = Guid.NewGuid(), Name = "SQL Server" };
			Category cat3 = new Category { Id = Guid.NewGuid(), Name = "jQuery" };
			context.Categories.Add(cat1);
			context.Categories.Add(cat2);
			context.Categories.Add(cat3);

			ThamSo color = new ThamSo{Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_COLOR, Value = "Đen"};
			context.ThamSos.Add(color);
			color = new ThamSo{Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_COLOR, Value = "Trắng"};
			context.ThamSos.Add(color);
			color = new ThamSo{Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_COLOR, Value = "Xanh"};
			context.ThamSos.Add(color);
			color = new ThamSo{Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_COLOR, Value = "Đỏ"};
			context.ThamSos.Add(color);
			color = new ThamSo{Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_COLOR, Value = "Vàng"};
			context.ThamSos.Add(color);
			color = new ThamSo{Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_COLOR, Value = "Tím"};
			context.ThamSos.Add(color);

			ThamSo brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Apple" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Nokia" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "HTC" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "BlackBerry" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Oppo" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Nexus" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "GiONNE" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Motorola" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Casio" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Asus" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Acer" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "Microsoft" };
			context.ThamSos.Add(brand);

			brand = new ThamSo { Id = Guid.NewGuid(), VType = 1, TType = Defines.THAMSO_TYPE_BRAND, Value = "LG" };
			context.ThamSos.Add(brand);
			//user
			//User user = new User
			//{
			//    LogName = "tinbq2",
			//    Name = "Bùi Quang Tín",
			//    Email = "tinbq2@gmail.com",
			//    IsAccessToAdmin = false,
			//    IsEmployee = false,
			//    IsBlocked = false,
			//    DateOfBirth = DateTime.Now,
			//    LastLogIn = DateTime.Now
					
			//};
			//context.Users.Add(user);

			//user = new User
			//{
			//    LogName = "hoangtx",
			//    Name = "Trần Xuân Hoàng",
			//    Email = "hoangtx@gmail.com",
			//    IsAccessToAdmin = false,
			//    IsEmployee = false,
			//    IsBlocked = false,
			//    DateOfBirth = DateTime.Now,
			//    LastLogIn = DateTime.Now
			//};
			//context.Users.Add(user);

			//user = new User
			//{
			//    LogName = "nhannt",
			//    Name = "Nguyễn Thái Nhân",
			//    Email = "nhannt@gmail.com",
			//    IsAccessToAdmin = false,
			//    IsEmployee = false,
			//    IsBlocked = false,
			//    DateOfBirth = DateTime.Now,
			//    LastLogIn = DateTime.Now
			//};
			//context.Users.Add(user);
			context.SaveChanges();
		}
	}
}